<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>支付页面</title>
<link rel="shortcut icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/style1.css" type="text/css" />
<script src="${pageContext.request.contextPath}/js/jquery-2.1.1.js"></script>
<script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
</head>	
<body>
	<nav id="top">
		<div class="container">
			<div class="row">
				<div class="col-xs-6">
					<ul class="language">
					<% if(request.getSession().getAttribute("userToken")!=null){ %>
					    <li style="float: left;">
					    <a href="${pageContext.request.contextPath}/userInfo/getUserInfo">
					    		你好!用户${sessionScope.userToken.userAccount }</a></li>
					    <%}else{ %>
						<li style="float: left;">
							<a href="${pageContext.request.contextPath}/pages/user/login.jsp">
							<span class="glyphicon glyphicon-log-in"></span>亲，请登录&nbsp;&nbsp;&nbsp;&nbsp;</a>
							</li>
						<li style="float: left;">
						<a href="${pageContext.request.contextPath}/pages/user/register.jsp">
						<span class="glyphicon glyphicon-pencil"></span>注册</a>
						</li>
						<%} %>
					</ul>
				</div>
				<div class="col-xs-6">
					<ul class="top-link">
						<li><a href="${pageContext.request.contextPath}/saleAccount/logout"><span class="glyphicon glyphicon-log-out"></span>注销</a></li>
					</ul>
				</div>
			</div>
		</div>
	</nav>
	<!--Header-->
		<header class="container">
		<div class="row">
			<div class="col-md-4">
				<div id="logo"><img  src="${pageContext.request.contextPath}/images/logo.png" /></div>
			</div>
			<div class="col-md-6">
				<div class="form-search" style="center">  
					<input type="text" class="input-medium search-query" id="goods_Name" placeholder="输入 手机名称/品牌">  
					<button class="btn" id="searchMh"><span class="glyphicon glyphicon-search"></span></button>  
				</div>
			</div>
		</div>
	</header>
	<br>
			<div >
				<div class="form-search" style="text-align:center" width: 100px >
				<div id="logo"><img  src="${pageContext.request.contextPath}/images/succeed.png"  style="weight:150px;height: 150px"/></div>  
						<h5 style="color:orange;">&nbsp;&nbsp;&nbsp;&nbsp;您的订单已支付成功</h5><br>  
				</div>
			</div>
			</div>
				<div style="text-align:center">   
					&nbsp;&nbsp;&nbsp;&nbsp;<a href="${pageContext.request.contextPath}/userInfo/getUserInfo" target="_blank">
					<button type="button" style="color:#ffffff;background-color: #E60000;width: 150px;height: 40px;">去我的订单查看</button> </a>
										&nbsp;&nbsp;&nbsp;&nbsp;<a href="${pageContext.request.contextPath}/goods/firstQuery">
					<button type="button" style="color:#ffffff;background-color: #E60000;width: 150px;height: 40px;">返回商城首页</button> </a>
				</div>
			</div>
 
	<div id="page-content" class="home-page">
		<div class="container">
			<div class="row">
				<div class="col-lg-12">
					<div class="heading" id="selectParent"><h2>推荐商品</h2></div>
					<div class="products" id="selectBox">
					</div>
				</div>
			</div>
		</div>
	</div>
</body>

<script type="text/javascript">
	//页面加载时候执行
	$(function(){
		$.ajax({
			type: 'POST',
			url: '${pageContext.request.contextPath }/goods/specialQuery',
			dataType: "json",
		 	success: function(data){
		 		$("#selectBox").remove();
				var main_div = $('<div class="products" id="selectBox"></div>');
				$("#selectParent").append(main_div);
				for(i in data){
					var div1 = $('<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12"></div>');
					var div2 = $('<div class="product"></div>');
					var div3 = $('<a href="${pageContext.request.contextPath }/goods/detail?id='+data[i].saleGoods.id+'" target="_blank"></a>');
					var div4 = $('<div class="image"><img style="width: 330px;height: 250px;" src="${pageContext.request.contextPath }/images/'+data[i].goods.icon+'" /></div>');
					var div5 = $('<div class="buttons"></div>');
					var div6 = $('<div class="caption"></div>');
					var div7 = $('<div class="name"><h3>'+data[i].goods.goodsName+'</h3></div>');
					var div8 = $('<div class="price">$'+data[i].saleGoods.price+'</div>');
					var div9 = $('<div class="rating"><span><a href="${pageContext.request.contextPath }/goods/detail?id='+data[i].saleGoods.id+'">速速抢购</a></span></div>');
					main_div.append(div1);
					div1.append(div2);
					div2.append(div3);
					div3.append(div4);
					div4.append(div5);
					div5.append(div6);
					div6.append(div7);
					div7.append(div8);
					div8.append(div9);
				}
			}
		});
	});
	
	$("#searchMh").on("click",function(){
		var value = $("#goods_Name").val();
		var url = "${pageContext.request.contextPath }/pages/user/searchProduct.jsp";
		window.open(encodeURI(url+"?mobileName="+value));
	});
</script>
</html>